There are 16*16 == 256 combinations of two characters corresponding to the 256 possible 8-bit patterns a byte could hold.
The 32 characters underlined by the red brackets represent the 16 bytes of the file.
(Two characters are printed for each byte.)
There is nothing in the file
between the four bytes of each int
.
The bytes follow one after another with nothing special
separating the last byte of one integer from the first byte
of the next.
I knew where to draw the red brackets because
I knew that each int
was four bytes long.
Without knowing this,
I would not know which bytes should be
grouped together.
If I did not know what this file was supposed to contain, I would not know how to group the bytes together or what they represented. This is similar to the situation in chapter 8 where the characters "MIX" appear on a slip of paper. Without context, you don't know what to make of an arbitrary pattern.
The first int
written to disk contains a zero.
The pattern above the first bracket shows the
32-bit pattern that represents the value zero.
Each "0" in the hex dump stands for four zero-bits
so the 32-bit pattern for the first int
is
00000000000000000000000000000000
that is, 32 zero bits.
The second group is a 32-bit representation of integer one. The hexadecimal character "1" represents 0001 so the pattern for this group is
00000000000000000000000000000001
The third group represents 255. The hexadecimal character "F" represents four bits with value one. So the value 255 is represented by 24 zero bits followed by 8 one bits.
00000000000000000000000011111111
Don't worry about these details; the idea is to show that the file contains bit patterns corresponding to the way integers are represented inside the processor. You will get much more of this stuff in a course in assembly language.
The last int
holds minus one.
What is the 32-bit representation of minus one?